Merged
Conversation
judah-sotomayor
approved these changes
Nov 4, 2025
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

for #8
Algorithm:
Function dirmap takes:
It returns an array of files for which the filter function returns true.
Function _traverse is a recursive helper function that takes:
It does not return a value, but rather pushes to the results array that it was given a reference to.
If a relative path is provided, dirmap finds the absolute path.
dirmap then passes the found absolute path for the start directory, the filter function, the recursion boolean, a 0 for current depth, the max depth, the symlinks boolean, and a reference to the found_files array (via @found_files) to _traverse.
_traverse opens the start directory and enters a while loop.
While unchecked entries exist in the directory:
skip . (current directory) and .. (previous directory)
find the absolute path of the current entry
if entry is not a symlink or symlink following is allowed:
Once the while loop completes, the directory is closed.
_traverse returns immediately if the current depth ever exceeds the max depth, immediately unraveling the recursion.
Once _traverse completes recursion, dirmap returns the array of matching files.